package com.mimi.enums;

import lombok.Getter;

/**
 * @Author:徐向
 * @Description:
 * @Date: Created in 14:41 2017/9/29
 */
@Getter
public enum OrderStatusEnum implements CodeEnum {
    NEW(0,"新订单"),
    FINISHED(1,"完结"),
    CANCEL(2,"已取消")
            ;
    private  Integer code;
    private String message;

    OrderStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

//用泛型写这通用的方法,定义一个接口CodeEnum,并实现,然后用泛型写一个工具类EnumUtil
//    public static OrderStatusEnum getOrderStatusEnum(Integer code) {
//        for (OrderStatusEnum orderStatusEnum: OrderStatusEnum.values()
//             ) {
//            if (orderStatusEnum.getCode().equals(code)) {
//                return orderStatusEnum;
//            }
//        }
//        return  null;
//    }
}
